home *** CD-ROM | disk | FTP | other *** search
/ Apple Reference & Presen…tion Library 2 (Reseller) / Apple R&P Lib Reseller v2.0.iso / 4-Fonts & Software / Demo Software / AppMaker / Demo AppMaker™ / Demo AppMaker™.rsrc / TmpP_202_Globals.txt < prev    next >
Encoding:
Text File  |  1989-04-09  |  2.2 KB  |  130 lines

  1. # (decoded with TMPL 11972)
  2. { %filename% }
  3. { Created %date% %time% by AppMaker }
  4.  
  5. Unit %unitname%;
  6. Interface
  7.  
  8. %If MPW%
  9. Uses
  10.     {$Load ToolBox.dump}
  11.         MemTypes,
  12.         QuickDraw,
  13.         OSIntf,
  14.         ToolIntf,
  15.         PackIntf;
  16.     {$Load}
  17.  
  18. %end if%
  19. %If Think%
  20. {$ifc undefined Think_Pascal}
  21. Uses
  22.     ListManager;
  23.  
  24. {$endc}
  25. %end if%
  26. Type
  27.     WinInfoRec        = record
  28.       {Standard fields:}
  29.         text:            TEHandle;
  30.         vScroll:        ControlHandle;      
  31.         hScroll:        ControlHandle;      
  32.         fileNum:        integer;             
  33.         volNum:            integer;            
  34.         dirty:            boolean;
  35.         filename:        StringHandle;
  36.         windowKind:        (noWindow%windowKinds%, fillerWK);
  37.         
  38.       {Application-specific fields:}
  39.       %DeclGlobals%
  40.     end; {WinInfoRec}
  41.     WinInfoPtr        = ^WinInfoRec;
  42.  
  43. var
  44.     quittingTime:    boolean;                             
  45.     curEvent:        EventRecord;                          
  46.     curWindow:        WindowPtr;
  47.     cur:            WinInfoPtr;
  48.     inBackground:    boolean;
  49.  
  50. {----------}
  51. Procedure InitGlobals;
  52. Procedure SetInfo      (window:    WindowPtr);
  53. Procedure SetNewInfo  (window:    WindowPtr);
  54. Procedure DiscardInfo (window:    WindowPtr);
  55.  
  56. {----------}
  57. Implementation
  58.  
  59. %If MPW%
  60. {$D+}
  61. {$R+}
  62. {$OV+}
  63.  
  64. %end if%
  65. var
  66.     noCur:            WinInfoRec;
  67.  
  68. %If MPW%
  69. {$S %unitname%}
  70.  
  71. %end if%
  72. {----------}
  73. Procedure InitGlobals;
  74. Begin
  75.     curWindow := nil;
  76.     with noCur do begin
  77.         text := nil;
  78.         vScroll := nil;
  79.         hScroll := nil;
  80.         fileNum := 0;
  81.         volNum := 0;
  82.         dirty := false;
  83.         windowKind := noWindow;
  84.     end; {with}
  85.     cur := @noCur;
  86. End; {InitGlobals}
  87.  
  88. {----------}
  89. Procedure SetInfo {(window:    WindowPtr)};
  90. var
  91.     infoPtr:        WinInfoPtr;
  92. Begin
  93.     if window <> curWindow then begin
  94.         curWindow := window;
  95.         if curWindow <> nil then begin
  96.             infoPtr := WinInfoPtr (GetWRefCon (curWindow));
  97.             cur := infoPtr;
  98.         end else begin
  99.             cur := @noCur;
  100.         end; {if}
  101.     end; {if}
  102. End; {SetInfo}
  103.  
  104. {----------}
  105. Procedure SetNewInfo {(window:    WindowPtr)};
  106. var
  107.     infoPtr:        WinInfoPtr;
  108. Begin
  109.     infoPtr := WinInfoPtr (NewPtr (sizeof (WinInfoRec)));
  110.     SetWRefCon (window, longint (infoPtr));
  111.     SetInfo (window);
  112. End; {SetNewInfo}
  113.  
  114. {----------}
  115. Procedure DiscardInfo {(window:    WindowPtr)};
  116. var
  117.     infoPtr:        WinInfoPtr;
  118. Begin
  119.     if window = curWindow then begin
  120.         SetInfo (nil);
  121.     end;
  122.     infoPtr := WinInfoPtr (GetWRefCon (window));
  123.     DisposPtr (Ptr (infoPtr));
  124.     HideWindow (window);
  125.     DisposeWindow (window);
  126. End; {DiscardInfo}
  127.  
  128. End. {%unitname%}
  129.  
  130.